<?php

namespace App\Http\Controllers;

use App\Facades\Tx;
use App\Models\Message;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class MessageController extends Controller
{
    public function index(Request $request)
    {
        $list = Message::where('uid',\Auth::id())->limit(15)->orderBy('created_at','desc')->orderBy("status")->get();
        return Tx::success($list);
    }
    public function read(Request $request,Message $message)
    {
        $message->update(['status'=>1]);
        return Tx::success($message,"操作成功");
    }
}
